﻿/*********************************************************************************
 *Author:         OnClick
 *Version:        1.0
 *UnityVersion:   2018.3.11f1
 *Date:           2019-04-23
 *Description:    IFramework
 *History:        2018.11--
*********************************************************************************/
using System;

namespace IFramework
{
    public interface IFSM
    {
        string Name { get; }
        IFSMState AnyStatusState { get; }
        IFSMState ExitState { get; }
        IFSMState StartState { get; }
        IFSMState CurrentState { get; }

        IFSMStateInfo SetExitState(IFSMState state, FSMStateType StateType);
        IFSMStateInfo SetStartState(IFSMState state, FSMStateType StateType);
        IFSMStateInfo SetAnyStatusState(IFSMState state, FSMStateType StateType);

        //T int float String Bool
        ITransitionCondtion CreateCondition<T>(string name, T defaultVal, TransitionCondtionType condtionType);

        StateTransition CreateTransition(StateTransitionType type, IFSMState head, IFSMState trail);
        void BindCondition(StateTransition transition, ITransitionCondtion condtion);
        void BindConditions(StateTransition transition, ITransitionCondtion[] condtion);
        void BindCustomCondition(StateTransition transition, Func<bool> condtion);

        IFSMStateInfo CreateState(IFSMState state, FSMStateType StateType);
        IFSMStateInfo BindTransition(IFSMStateInfo info, StateTransition transition);
        IFSMStateInfo BindTransitions(IFSMStateInfo info, StateTransition[] transitions);

        void Run();
        void Stop();

        void SetBool(string ConditionName, bool value);
        void SetInt(string ConditionName, int value);
        void SetFloat(string ConditionName, float value);
        void SetString(string ConditionName, string value);
    }
}
